#!/usr/local/bin/python3
# -*- coding: UTF-8 -*-
"""
@author:apple
@file:demo01.py
@time:2021/06/29
"""
import time


def test01(file_path):
    ...

    with open(file_path, mode='rb') as f:
        ...
        '''
        offset: 相对位置 
        whence: 
            0: 文件开始
            1: 指针的当前位置
            2: 文件末尾
        
        seek函数的偏移单位为一个 byte，所以一般使用在 mode为b 的字节读取过程中 
        '''
        f.seek(0, 2)
        while True:
            content = f.readline()
            if content:
                ctt = content.decode('utf-8')
                print(ctt, end='')
            time.sleep(0.5)


if __name__ == '__main__':
    pass
    content = '\u7f51\u7edc\u51fa\u9519,\u8f7b\u89e6\u5c4f\u5e55\u91cd\u65b0\u52a0\u8f7d'
    print(content)
    test01('./tail_f.txt')
